<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
    <head>
        <title>Spring intro - users listing</title>
    </head>
    <body>
        <c:choose>
            <c:when test="${users != null}">
                <h1>Displaying the list of database users</h1>

                <br>

                <c:choose>
                    <c:when test="${filtering == true}">
                        <h2>Displaying the filtered users</h2>
                    </c:when>

                    <c:otherwise>
                        <h2>Displaying the non-filtered users</h2>
                    </c:otherwise>
                </c:choose>

                <ul>
                    <c:forEach items="${users}" var="user">
                        <li>${user.firstName} ${user.lastName} ['${user.userName}']</li>
                    </c:forEach>
                </ul>
            </c:when>

            <c:otherwise>
                <h2>There are no users to display</h2>
            </c:otherwise>
        </c:choose>
    </body>
</html>